//package src;
import java.awt.*;

public class DrawRect extends Order 
{
	
	private Point first;      
	
	public void mousePressExe(Point p, Drawing Layer)
	{
 		first = p;
 		ShapeRect r = new ShapeRect(p.x, p.y, 0, 0, Layer.getColor());

 		Layer.add(r);
	}

	
	public void mouseDragShiftExe(Point p, Drawing Layer)
	{
 		ShapeRect r = new ShapeRect(Math.min(p.x, first.x), Math.min(p.y, first.y),
         	Math.abs(p.x - first.x), Math.abs(p.x - first.x), Layer.getColor());
	
 		Layer.remainEndshape(r);	
	}
	
	public void mouseDragExe(Point p, Drawing Layer, GraphicsObject graphics)
	{
 		ShapeRect r = new ShapeRect(Math.min(p.x, first.x), Math.min(p.y, first.y),
         	Math.abs(p.x - first.x), Math.abs(p.y - first.y), Layer.getColor());
 		
 		Layer.remainEndshape(r);	
	}
}